package com.ruoyi.combat.service.useralignment.impl;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ruoyi.combat.domain.useralignment.CombatBlogWb;
import com.ruoyi.combat.domain.useralignment.CombatUserWb;
import com.ruoyi.combat.domain.useralignment.CombatUserZh;
import com.ruoyi.combat.mapper.useralignment.CombatUserZhMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.combat.mapper.useralignment.CombatBlogZhMapper;
import com.ruoyi.combat.domain.useralignment.CombatBlogZh;
import com.ruoyi.combat.service.useralignment.ICombatBlogZhService;

/**
 * 知乎用户发布内容Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-10
 */
@Service
public class CombatBlogZhServiceImpl implements ICombatBlogZhService 
{
    @Autowired
    private CombatBlogZhMapper combatBlogZhMapper;
    @Autowired
    private CombatUserZhMapper combatUserZhMapper;

    /**
     * 查询知乎用户发布内容
     * 
     * @param id 知乎用户发布内容主键
     * @return 知乎用户发布内容
     */
    @Override
    public CombatBlogZh selectCombatBlogZhById(Long id)
    {
        return combatBlogZhMapper.selectCombatBlogZhById(id);
    }

    /**
     * 查询知乎用户发布内容列表
     * 
     * @param combatBlogZh 知乎用户发布内容
     * @return 知乎用户发布内容
     */
    @Override
    public List<CombatBlogZh> selectCombatBlogZhList(CombatBlogZh combatBlogZh)
    {
        return combatBlogZhMapper.selectCombatBlogZhList(combatBlogZh);
    }

    /**
     * 新增知乎用户发布内容
     * 
     * @param combatBlogZh 知乎用户发布内容
     * @return 结果
     */
    @Override
    public int insertCombatBlogZh(CombatBlogZh combatBlogZh)
    {
        return combatBlogZhMapper.insertCombatBlogZh(combatBlogZh);
    }

    /**
     * 修改知乎用户发布内容
     * 
     * @param combatBlogZh 知乎用户发布内容
     * @return 结果
     */
    @Override
    public int updateCombatBlogZh(CombatBlogZh combatBlogZh)
    {
        return combatBlogZhMapper.updateCombatBlogZh(combatBlogZh);
    }

    /**
     * 批量删除知乎用户发布内容
     * 
     * @param ids 需要删除的知乎用户发布内容主键
     * @return 结果
     */
    @Override
    public int deleteCombatBlogZhByIds(Long[] ids)
    {
        return combatBlogZhMapper.deleteCombatBlogZhByIds(ids);
    }

    /**
     * 删除知乎用户发布内容信息
     * 
     * @param id 知乎用户发布内容主键
     * @return 结果
     */
    @Override
    public int deleteCombatBlogZhById(Long id)
    {
        return combatBlogZhMapper.deleteCombatBlogZhById(id);
    }

    @Override
    public List<Map> sendStatistics(String userId) {
        return combatBlogZhMapper.sendStatistics(userId);
    }

    @Override
    public Map numberStatistics(String userId) {
        CombatBlogZh combatBlog = new CombatBlogZh();
        combatBlog.setUserId(userId);
        List<CombatBlogZh> combatBlogs = combatBlogZhMapper.selectCombatBlogZhList(combatBlog);
        CombatUserZh combatUser = combatUserZhMapper.selectCombatUserZhByUserId(userId);
        Map<String,Long> result = new HashMap<>();
        result.put("userFansNum", combatUser.getUserFansNum());
        result.put("userFocusNum", combatUser.getUserFocusNum());
        result.put("userBlogNum", (long) combatBlogs.size());
        return result;
    }

}
